﻿
namespace DeepZoomPivotConstructor.PivotLib.PivotSchema
{
    /// <summary>
    /// Some other classes we want for collection
    /// </summary>
    public partial class Collection
    {
        /// <summary>
        /// The PV guy can't deal with facet categories being an empty XML element, so suppress it when
        /// we are emitting a guy with nothing in it.
        /// </summary>
        /// <returns></returns>
        public bool ShouldSerializeFacetCategories()
        {
            if (FacetCategories != null)
                if (FacetCategories.FacetCategory != null)
                    return FacetCategories.FacetCategory.Length != 0;
            return false;
        }
    }

    public partial class item
    {
        /// <summary>
        /// The PV control can't deal with a list of Facets being empty. So, when that happens,
        /// suppress the output of the Facet's XML element.
        /// </summary>
        /// <returns></returns>
        public bool ShouldSerializeFacets()
        {
            if (Facets != null)
                if (Facets.Facet != null)
                    return Facets.Facet.Length != 0;
            return false;
        }
    }
}
